package com.adl.hotelmanage.util;


import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.Scanner;

public class jdbcutils {
	
	 public static Connection connection=null; 
	public jdbcutils() {
		
	}
	
	public static Connection jdbc() {
		if(connection==null) { 
			String driverName = "com.mysql.jdbc.Driver";
		String url="jdbc:mysql://localhost:3306/hoteldb?useUnicode=true&characterEncoding=utf-8";
		  try {
			  Class.forName(driverName);
			connection = DriverManager.getConnection(url, "root",	"tpphello");
		} catch (SQLException | ClassNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} 
		  }
		return connection;
		
	}
	
	


public static void main(String[] args) {
Connection a= jdbcutils.jdbc();
Connection b= jdbcutils.jdbc();
if(a==b) {
	System.out.println("ciangtong");
}
}


}

